class YLDoubleClick {
  static DateTime? _dateTime;
  // 防连点处理  1.5s内连点判定无效
  static bool disapleClick({int validtime = 1500}) {
    DateTime nowTime = DateTime.now();
    if (_dateTime != null &&
        nowTime.difference(_dateTime!).inMilliseconds < validtime) {
      return true;
    }
    _dateTime = nowTime;
    return false;
  }

  static bool effectClick({int validtime = 1500}) {
    DateTime nowTime = DateTime.now();
    if (_dateTime != null &&
        nowTime.difference(_dateTime!).inMilliseconds < validtime) {
      return false;
    }
    _dateTime = nowTime;
    return true;
  }
}
